import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/model/article_resp.dart';
import 'package:flutter_app/res/colours.dart';
import 'package:flutter_app/routers/router_utils.dart';

class ListArticleItem extends StatelessWidget {
  ArticleBean _bean;

  ListArticleItem(ArticleBean bean) {
    _bean = bean;
  }

  @override
  Widget build(BuildContext context) => Material(
      color: Colors.white,
      // width: MediaQuery.of(context).size.width,
      // margin: EdgeInsets.only(top: 5, bottom: 5),
      // padding: EdgeInsets.only(bottom: 10, top: 10),
      child: InkWell(
        onTap: () =>
            RouterUtils.goWebViewPage(context, _bean.title, _bean.link),
        child: Column(
          children: [
            Padding(
              padding: EdgeInsets.only(left: 10, top: 15),
              child: Row(
                children: [
                  Text(_bean.chapterName,
                      style: TextStyle(fontSize: 12, color: Colours.ff888888)),
                  Text(' | ${_bean.niceDate}',
                      style: TextStyle(fontSize: 12, color: Colours.ff888888)),
                ],
              ),
            ),
            Container(
              alignment: Alignment.centerLeft,
              padding: EdgeInsets.only(left: 10, top: 15, right: 10),
              child: Text(_bean.title,
                  softWrap: true,
                  maxLines: 2,
                  style: TextStyle(
                      fontSize: 15,
                      color: Colours.ff2c2c2c,
                      fontWeight: FontWeight.bold)),
            ),
            Padding(
                padding: EdgeInsets.only(left: 10, top: 15, right: 10, bottom: 15),
                child: Row(
                  children: [
                    Text(_bean.superChapterName,
                        style:
                            TextStyle(fontSize: 12, color: Colours.ff888888)),
                    Text(' - ${_bean.shareUser}',
                        style:
                            TextStyle(fontSize: 12, color: Colours.ff888888)),
                    Flexible(fit: FlexFit.tight, child: SizedBox())
                  ],
                )),
          ],
        ),
      ));
}
